package net.wanho.service.impl;

import net.wanho.dto.LoginUser;
import net.wanho.service.AuthService;
import net.wanho.util.JwtUtil;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * Author：汤小洋
 * Date：2024-01-30 16:54
 * Description：<描述>
 */
@Service
public class AuthServiceImpl implements AuthService {

    @Override
    public String login(LoginUser loginUser) {
        /**
         * 判断验证码
         */


        /**
         * 判断用户
         */
        // User user = userMapper.selectByUsername(loginUser.getUsername());


        /**
         * 生成token
         */
        Map<String,Object> payload = new HashMap<>();
        payload.put("username",loginUser.getUsername());
        String token = JwtUtil.generate(payload);

        return "Bearer " + token;
    }
}
